home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / GETRIGHT.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  700b  |  23 lines

  1. ' GETRIGHT.BAS
  2. ' This program demonstrates the RIGHT$ function.
  3.  
  4. CLS
  5.  
  6. alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"   ' declare test string
  7.  
  8. PRINT "How many characters (from right to left) in the following"
  9. PRINT "string would you like to display?"
  10. PRINT
  11. PRINT alphabet$                            ' display test string
  12. PRINT
  13.  
  14.     ' get from user number of rightmost characters to be displayed
  15. DO  ' loop until number is in proper range (1 through 26)
  16.     INPUT "    Number (1-26):  ", rightNum%
  17. LOOP WHILE (rightNum% < 1) OR (rightNum% > 26)
  18.  
  19. PRINT
  20. rightChar$ = RIGHT$(alphabet$, rightNum%)  ' display characters
  21. PRINT "You specified"; LEN(rightChar$); "characters:  "; rightChar$
  22.  
  23.